/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cse308.helper_classes;

import cse308.General;
import cse308.GeneralEntity;
import cse308.entities.Peo;
import cse308.entities.Targetattainmentlevel;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author dwysocki
 */
public class PEOClass implements GeneralTest {

    private String identifier;
    private Integer seqNum;
    private String shortname;
    private String description;
    private Integer semster;
    private Integer yea;
    private Integer endsemester;
    private Integer endyear;
    private Integer currentAttainment;
    private Map<String, String> attainmentLevels;
    private String currentSemester;

    public PEOClass(Peo entity) {
        this.identifier = entity.getIdentifier();
        this.seqNum = entity.getSeqNum();
        this.shortname = entity.getShortname();
        this.description = entity.getDescription();
        this.yea = entity.getYea();
        this.semster = entity.getSemster();
        this.attainmentLevels = new HashMap();
        Collection<Targetattainmentlevel> talList = entity.getTargetattainmentlevelCollection();
        for (Targetattainmentlevel tal : talList) {
            String toadd = tal.getTargetattainmentlevelPK().getSemester() + " " + tal.getAttainmentlevel();
            this.attainmentLevels.put(toadd, toadd);
        }
    }

   

    @Override
    public ArrayList<Map<String, General>> getMap() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public ArrayList<List<String>> getList() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public GeneralEntity findCorrespondingEntity() {
        EntityManagerFactory emf = Persistence.createEntityManagerFactory("CSE_308_ABETPU");
        EntityManager em = emf.createEntityManager();
        return em.find(Peo.class, this.identifier);
    }

    @Override
    public boolean equalsEntity(GeneralEntity toEqual) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

   // @Override
    public void updateRelationship(GeneralEntity ge1) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    public String getIdentifier() {
        return identifier;
    }

    public void setIdentifier(String identifier) {
        this.identifier = identifier;
    }

    public Integer getSeqNum() {
        return seqNum;
    }

    public void setSeqNum(Integer seqNum) {
        this.seqNum = seqNum;
    }

    public String getShortname() {
        return shortname;
    }

    public void setShortname(String shortname) {
        this.shortname = shortname;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getSemster() {
        return semster;
    }

    public void setSemster(Integer semster) {
        this.semster = semster;
    }

    public Integer getYea() {
        return yea;
    }

    public void setYea(Integer yea) {
        this.yea = yea;
    }

    public Integer getEndsemester() {
        return endsemester;
    }

    public void setEndsemester(Integer endsemester) {
        this.endsemester = endsemester;
    }

    public Integer getEndyear() {
        return endyear;
    }

    public void setEndyear(Integer endyear) {
        this.endyear = endyear;
    }

    public Integer getCurrentAttainment() {
        return currentAttainment;
    }

    public void setCurrentAttainment(Integer currentAttainment) {
        this.currentAttainment = currentAttainment;
    }

    public Map<String, String> getAttainmentLevels() {
        return attainmentLevels;
    }

    public void setAttainmentLevels(Map<String, String> attainmentLevels) {
        this.attainmentLevels = attainmentLevels;
    }

    public String getCurrentSemester() {
        return currentSemester;
    }

    public void setCurrentSemester(String currentSemester) {
        this.currentSemester = currentSemester;
    }

    @Override
    public String getIdentifier2() {
        return this.identifier;
    }
    
}